export const updateQueryParams = (url, newParams) => {
    const urlObj = new URL(url);
    const params = new URLSearchParams(urlObj.search);

    // 覆盖或添加新的查询参数
    for (const [key, value] of Object.entries(newParams)) {
        params.set(key, value);
    }

    // 输出新的URL
    urlObj.search = params.toString();
    return urlObj.toString();
}

export const removeQueryParam = (url, key) => {
    const updatedUrl = new URL(url);
    updatedUrl.searchParams.delete(key);
    return updatedUrl.toString();
}